import request from '@/utils/request'

export const api_getChannels = () => {
  return request({
    url: '/channels'
  })
}

export const api_publishAticle = data => {
  return request({
    url: '/mp/articles?draft=false',
    method: 'POST',
    data
  })
}

export const api_getAticleList = params => {
  return request({
    url: '/mp/articles',
    params
  })
}

export const api_getAticleById = id => {
  return request({
    url: `/mp/articles/${id}`
  })
}

export const api_delAticleById = id => {
  return request({
    method: 'DELETE',
    url: `/mp/articles/${id}`
  })
}

export const api_editAticle = (id, data) => {
  return request({
    method: 'PUT',
    url: `/mp/articles/${id}?draft=false`,
    data
  })
}
